
import 'package:flustars/flustars.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBBaseRouter/YBApplication.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBBaseRouter/YBNavigator.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBImageStyle/YBImageStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:flutter/material.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/yb_chinese_text/yb_chinese_text.dart';

enum mishuType {
  mishuTYpe_yijitong,
  mishuTYpe_lvsitong,
  mishuTYpe_mishutong,
}

class YBGeneralMiShuJieShaoPage extends StatelessWidget {

  final mishuType type;

  const YBGeneralMiShuJieShaoPage({Key key, this.type}) : super(key: key);

  @override
  Widget build(BuildContext context) {


    String title;

    String subTitle;

    Color textColor;

    String backImageStr;

    String loginImageStr;

    String headerTitle;

    if (type == mishuType.mishuTYpe_lvsitong) {
        title = YBChineseText.workTaiJinRiLvSiZhuangShuGongNengTitle;
        subTitle = YBChineseText.workTaiJinRiLvSiZhuangShuGongNengSubTitle;
        textColor = YBColor.colorCC272D;
        backImageStr = 'workTai_lvsitongImageView';
        loginImageStr = 'jinrilvsi_worktai_imageVIew';
        headerTitle = YBChineseText.workTaiZhuanShuYingYongLvSiTongTitle;
    }else if (type == mishuType.mishuTYpe_yijitong) {
      title = YBChineseText.workTaiYIJiWangZhuangShuGongNengTitle;
      subTitle = '';
      textColor = YBColor.colorFF5500;
      backImageStr = 'yijiwang_beijingban';
      loginImageStr = 'yijiwang_logo';
      headerTitle = YBChineseText.workTaiZhuanShuYingYongYiJiTongTitle;
    } else if (type == mishuType.mishuTYpe_mishutong) {
      title = YBChineseText.workTaiEBanShiZhuangShuGongNengTitle;
      subTitle = YBChineseText.workTaiEBanShiZhuangShuGongNengSubTitle;
      textColor = YBColor.color0581F4;
      backImageStr = 'gongzuotaiyibanshi_ebanshi';
      loginImageStr = 'workTai_ebanshiwenzi';
      headerTitle = YBChineseText.workTaiZhuanShuYingYongMiShuTongTitle;
    }else {
      title = YBChineseText.workTaiJinRiLvSiZhuangShuGongNengTitle;
      subTitle = YBChineseText.workTaiJinRiLvSiZhuangShuGongNengSubTitle;
      textColor = YBColor.colorCC272D;
      backImageStr = 'workTai_lvsitongImageView';
      loginImageStr = 'jinrilvsi_worktai_imageVIew';
      headerTitle = YBChineseText.workTaiZhuanShuYingYongLvSiTongTitle;
    }



    return Container(
        color: YBColor.colorF5F5F7,
        child:Scaffold(
          body: SingleChildScrollView(
            child: SafeArea(
              child:Stack(
                children: [
                  Container(
                    child: Image.asset(YBImageStyle.getImagePath(backImageStr)),
                  ),
                  Container(
                    child:Column(
                      children: [
                        Container(
                          height: YBTextStyle.adapterSize12,
                        ),
                        Container(
                          child: InkWell(
                            child: Row(
                              children: [
                                Container(
                                  width: YBTextStyle.adapterSize20,
                                ),
                                Container(
                                  child:Image.asset(YBImageStyle.getImagePath('common_whiteImage'),width: YBTextStyle.adapterSize18,height: YBTextStyle.adapterSize16,),
                                ),
                                Container(
                                  width: YBTextStyle.adapterSize10,
                                ),
                                Container(
                                  child: Text(headerTitle,style: YBTextStyle.TextStyleFFFFFF18Medium,),
                                ),
                              ],
                            ),
                            onTap: (){
                              YBNavigatorUtil.goDefaultBack(context);
                            },
                          ),
                        ),
                        Container(
                          child: Padding(
                            padding:EdgeInsets.only(left:YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20,top: YBTextStyle.adapterSize110,bottom: YBTextStyle.adapterSize10),
                            child: Container(
                              decoration: BoxDecoration(
                                color:YBColor.white,
                                borderRadius: BorderRadius.all(Radius.circular(8.0)),
                              ),
                              child: Column(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.stretch,
                                children: [
                                  Container(
                                    height: YBTextStyle.adapterSize36,
                                  ),
                                  Container(
                                    height: YBTextStyle.adapterSize40,
                                    width: YBTextStyle.adapterSize132,
                                    alignment: Alignment.center,
                                    child: Image.asset(YBImageStyle.getImagePath(loginImageStr)),
                                  ),
                                  Container(
                                    height: YBTextStyle.adapterSize40,
                                  ),
                                  Container(
                                    alignment: Alignment.center,
                                    child: Text(title??"",style: YBTextStyle.TextStyle30313320Semibold,),
                                  ),
                                  Container(
                                    height: YBTextStyle.adapterSize16,
                                  ),
                                  Container(
                                    alignment: Alignment.center,
                                    child: Text(subTitle??"",style: YBTextStyle.TextStyle60626614),
                                  ),
                                  Container(
                                    height: YBTextStyle.adapterSize48,
                                  ),
                                  Container(
                                    alignment: Alignment.center,
                                    child: RichText(
                                      text: TextSpan(
                                          text: YBChineseText.woYiYueDuBingTongYiTitle,
                                          style: YBTextStyle.TextStyle969AA313,
                                          children: [
                                            TextSpan(
                                              text: YBChineseText.workTaiZhangShangFuWuXieYiTitle,
                                              style: TextStyle(
                                                fontSize: YBTextStyle.adapterSize13,
                                                color:textColor,
                                              ),
                                            ),
                                            TextSpan(
                                              text: YBChineseText.workTaiXiangGuanShouQuanXieYiTitle,
                                              style: YBTextStyle.TextStyle969AA313,
                                            ),
                                          ]
                                      ),
                                    ),
                                  ),
                                  Container(
                                    height: YBTextStyle.adapterSize16,
                                  ),
                                  Container(
                                    height: YBTextStyle.adapterSize58,

                                    child: Padding(
                                      padding: EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                                      child: RawMaterialButton(
                                          fillColor: textColor,
                                          shape: RoundedRectangleBorder(
                                            borderRadius: BorderRadius.all(Radius.circular(YBTextStyle.adapterSize8)),
                                          ),
                                          child: Text(YBChineseText.workTaiAgreeWorkingTitle,style: YBTextStyle.TextStyleFFFFFF18Medium,),
                                          onPressed: (){
                                            if (type == mishuType.mishuTYpe_yijitong) {
                                              YBApplication.router.navigateTo(context, '/workTaiPage/workTaiYiJiTongPage');
                                              SpUtil.putString('mishuTYpe_yijitong', "1");

                                            } else if (type == mishuType.mishuTYpe_lvsitong) {
                                              YBApplication.router.navigateTo(context, '/workTaiPage/workTaiLvSiTongPage');
                                              SpUtil.putString("mishuTYpe_lvsitong","1");
                                            } else if (type == mishuType.mishuTYpe_mishutong) {
                                              YBApplication.router.navigateTo(context, '/workTaiPage/workTaiMiShuTongPage');
                                              SpUtil.putString("mishuTYpe_mishutong", "1");
                                            }
                                          }),
                                    ),
                                  ),
                                  Container(
                                    height: YBTextStyle.adapterSize32,
                                  ),
                                  Container(
                                    alignment: Alignment.center,
                                    child: Text(YBChineseText.workTaiZiXunTelPhoneTitle,style: YBTextStyle.TextStyle969AA313),
                                  ),
                                  Container(
                                    height: YBTextStyle.adapterSize24,
                                  ),
                                ],
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
    );
  }
}
